package com.lagou;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * @author：dingyuan
 * @date：Created in 2022/1/4 22:05
 * @description：作业二测试类
 * @version: 1.0
 */
public class WorkTowTest {
    public static void main(String[] args){

        List<Worker> workerList = new ArrayList<>();

        workerList.add(new Worker("凤姐",18,2000));
        workerList.add(new Worker("欧阳峰",60,6000));
        workerList.add(new Worker("刘德华",40,40000));
        // 在“欧阳锋”之前插入一个员工“张柏芝”
        workerList.add(1,new Worker("张柏芝",38,5000));
        for (Worker wk : workerList) {
            System.out.println(wk);
        }

        System.out.println("==============================================");
        // 删除“刘德华”的信息
        workerList.remove(new Worker("刘德华",40,40000));
        for (Worker wk : workerList) {
            System.out.println(wk);
        }

        System.out.println("==============================================");
        Iterator<Worker> workerIterator = workerList.iterator();
        while (workerIterator.hasNext()){
            workerIterator.next().work();
        }
    }
}
